From d5a44c19ceeda9927a0ad6eb02bef4ed08128f0a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 9 Nov 2023 16:03:29 -0800 Subject: rename fund name to id --- src/routes/(app)/fund/[name]/+page.server.js | 23 ---- src/routes/(app)/fund/[name]/+page.svelte | 138 --------------------- src/routes/(app)/fund/[name]/sweep/+page.server.js | 14 --- src/routes/(app)/fund/[name]/sweep/+page.svelte | 37 ------ .../(app)/fund/[name]/withdraw/+page.server.js | 20 --- src/routes/(app)/fund/[name]/withdraw/+page.svelte | 58 --------- src/routes/(app)/fund/[name]/withdraw/+server.js | 6 - 7 files changed, 296 deletions(-) delete mode 100644 src/routes/(app)/fund/[name]/+page.server.js delete mode 100644 src/routes/(app)/fund/[name]/+page.svelte delete mode 100644 src/routes/(app)/fund/[name]/sweep/+page.server.js delete mode 100644 src/routes/(app)/fund/[name]/sweep/+page.svelte delete mode 100644 src/routes/(app)/fund/[name]/withdraw/+page.server.js delete mode 100644 src/routes/(app)/fund/[name]/withdraw/+page.svelte delete mode 100644 src/routes/(app)/fund/[name]/withdraw/+server.js (limited to 'src/routes/(app)/fund/[name]') diff --git a/src/routes/(app)/fund/[name]/+page.server.js b/src/routes/(app)/fund/[name]/+page.server.js deleted file mode 100644 index ad20c7d9..00000000 --- a/src/routes/(app)/fund/[name]/+page.server.js +++ /dev/null @@ -1,23 +0,0 @@ -import { error, redirect } from '@sveltejs/kit'; -import { auth, get, post } from '$lib/utils'; -import Qr from 'qrcode-base64'; - -export let load = async ({ params: { name }, url }) => { - let { amount, payments } = await get(`/fund/${name}`); - - let src = Qr.drawImg(url.href, { size: 300 }); - return { amount, payments, src }; -}; - -export const actions = { - default: async ({ cookies, locals, params, request }) => { - let { user } = locals; - - if (user) { - await post('/redeem', params, auth(cookies)); - throw redirect(307, `/${user.username}/payments`); - } - - throw redirect(307, '/register'); - } -}; diff --git a/src/routes/(app)/fund/[name]/+page.svelte b/src/routes/(app)/fund/[name]/+page.svelte deleted file mode 100644 index 0ac10c24..00000000 --- a/src/routes/(app)/fund/[name]/+page.svelte +++ /dev/null @@ -1,138 +0,0 @@ - - -
-
-
-
- - {#if name.split('-').length === 4} -

Card {name}

- {:else} - Fund -
-

{$t('payments.fund')}

-

{name}

-
- {/if} -
- {#if show} - {name} - {/if} -
-
-

- {f(amountFiat, currency)} -

-

- {sat(amount)} -

-
-
- -
- - -
- -
-
-
diff --git a/src/routes/(app)/fund/[name]/sweep/+page.server.js b/src/routes/(app)/fund/[name]/sweep/+page.server.js deleted file mode 100644 index 929348ef..00000000 --- a/src/routes/(app)/fund/[name]/sweep/+page.server.js +++ /dev/null @@ -1,14 +0,0 @@ -import { get, auth, post } from '$lib/utils'; -import { redirect } from '@sveltejs/kit'; - -export async function load({ cookies, params, parent }) { - let { user } = await parent(); - let { name } = params; - let { amount } = await get(`/fund/${name}`); - - - if (!amount) throw redirect(307, `/fund/${name}`); - if (!user) throw redirect(307, `/register?redirect=/fund/${name}/sweep`); - await post('/take', { amount, name }, auth(cookies)); - return { amount, name }; -} diff --git a/src/routes/(app)/fund/[name]/sweep/+page.svelte b/src/routes/(app)/fund/[name]/sweep/+page.svelte deleted file mode 100644 index 9b473af3..00000000 --- a/src/routes/(app)/fund/[name]/sweep/+page.svelte +++ /dev/null @@ -1,37 +0,0 @@ - - -
-
- - - -
- -
- -
-

{$t('payments.fundsClaimed')}

-

- {f(fiat(amount, rate), currency)} -

-

- ⚡️{s(amount)} -

-
- - -
- - -
{$t('payments.tapAnywhere')}
diff --git a/src/routes/(app)/fund/[name]/withdraw/+page.server.js b/src/routes/(app)/fund/[name]/withdraw/+page.server.js deleted file mode 100644 index 4d590890..00000000 --- a/src/routes/(app)/fund/[name]/withdraw/+page.server.js +++ /dev/null @@ -1,20 +0,0 @@ -import { fail, json, redirect } from '@sveltejs/kit'; -import { fd, auth, post } from '$lib/utils'; - -export async function load({ parent }) { - let { user } = await parent(); - if (!user) throw redirect(307, '/register'); -} - -export const actions = { - default: async ({ cookies, request }) => { - let body = await fd(request); - try { - await post('/take', body, auth(cookies)); - } catch (e) { - return fail(400, { message: e.message }); - } - - throw redirect(307, `/fund/${body.name}`); - } -}; diff --git a/src/routes/(app)/fund/[name]/withdraw/+page.svelte b/src/routes/(app)/fund/[name]/withdraw/+page.svelte deleted file mode 100644 index 7be643a9..00000000 --- a/src/routes/(app)/fund/[name]/withdraw/+page.svelte +++ /dev/null @@ -1,58 +0,0 @@ - - - - -{#if form?.message} -
- {form.message} -
-{/if} - -
- - -
- - - - -
- -
-
-
diff --git a/src/routes/(app)/fund/[name]/withdraw/+server.js b/src/routes/(app)/fund/[name]/withdraw/+server.js deleted file mode 100644 index 0f9a23f3..00000000 --- a/src/routes/(app)/fund/[name]/withdraw/+server.js +++ /dev/null @@ -1,6 +0,0 @@ -import { json } from '@sveltejs/kit'; -import { auth, post } from '$lib/utils'; - -export async function POST({ cookies, request }) { - return json(await post('/take', await request.json(), auth(cookies))); -} -- cgit v1.2.3